#include <stdio.h>

void printPascalsTriangle(int n) {
    int arr[n][n];

    // Initialize the first row and first column of the triangle
    for (int i = 0; i < n; i++) {
        arr[i][0] = 1;
        arr[i][i] = 1;
    }

    // Fill the Pascal's Triangle
    for (int i = 2; i < n; i++) {
        for (int j = 1; j < i; j++) {
            arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
        }
    }

    // Print the Pascal's Triangle
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j > 0) {
                printf(" ");
            }
            printf("%d", arr[i][j]);
        }
        printf("\n");
    }
}

int main() {
    int n;
    printf("Enter the number of rows: ");
    scanf("%d", &n);

    printPascalsTriangle(n);

    return 0;
}